package com.gaohe.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gaohe.common.Result;
import com.gaohe.mapper.MemberMapper;
import com.gaohe.pojo.Member;
import com.gaohe.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {

    @Override
    public Result getMemberByUserId(Long userId) {
        //1.构建查询条件
        LambdaQueryWrapper<Member> qw = new LambdaQueryWrapper<>();
        qw.eq(Member::getUserId,userId);
        //2.查询
        Member member = this.getOne(qw);
        //3.返回结果
        return Result.success(member);
    }
}
